package com.bit.demo;

import com.bit.demo.Config.User;
import com.bit.demo.Controller.UserController;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
public class SpringMvcIoC1Application {

    public static void main(String[] args) {
        ApplicationContext context = SpringApplication.run(SpringMvcIoC1Application.class, args);

//        UserController userController = context.getBean(UserController.class);
//        UserController userController1 = (UserController) context.getBean("userController");
//        UserController userController2 = context.getBean("userController", UserController.class);
//
//        System.out.println(userController);
//        System.out.println(userController1);
//        System.out.println(userController2);
//        UserService userService = context.getBean(UserService.class);
//        userService.sayHello();
//        UserRepository userRepository = context.getBean(UserRepository.class);
//        userRepository.sayHello();
//        UserComponent userComponent = context.getBean(UserComponent.class);
//        userComponent.sayHello();
//        User user = context.getBean(User.class);
//        System.out.println(user);
//        User user1 = (User) context.getBean("user1");
//        User u1 = (User) context.getBean("u1");
//        User user2 = (User) context.getBean("user2");
//        System.out.println(user1);
//        System.out.println(u1);
//        System.out.println(user2);
        UserController userController = context.getBean(UserController.class);
        userController.sayHello();


    }

}
